﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Layout.master" AutoEventWireup="true" CodeFile="productPages.aspx.cs" Inherits="productPages" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="productMainPages" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:ListView ID="ListView1" runat="server" DataKeyNames="id" DataSourceID="SqlDataSourceDealMoi"
        GroupItemCount="3">
        <GroupTemplate>
            <tr id="itemPlaceholderContainer" runat="server">
                <td id="itemPlaceholder" runat="server">
                </td>
            </tr>
        </GroupTemplate>
        <ItemTemplate>
            <td id="Td1" runat="server">
                <div class="small-box-white">
                    <h3>
                        <a href='<%# "itemPage.aspx?id="+Eval("id") %>'name='<%# Eval("ten_sp") %>' title='<%# Eval("ten_sp") %>'>
                            <%# Eval("ten_sp") %></a></h3>
                    <div class="small-box-img">
                        <a href='<%# "itemPage.aspx?id="+Eval("id") %>' name='<%# Eval("ten_sp") %>'>
                            <img src='<%# "upload/" + Eval("anh_1") %>' width="268" height="166" alt="Tài Nguyễn Salon"
                                title="Tài Nguyễn Salon">
                            <span class="giaovoucher"></span></a><i></i>&nbsp;&nbsp;&nbsp;&nbsp;</div>
                    <div class="small-box-text">
                        <p>
                            <%# Eval("mo_ta_sp") %>....
                        </p>
                    </div>
                    <div class="small-box-button">
                        <a href='<%# "itemPage.aspx?id="+Eval("id") %>' name='<%# Eval("ten_sp") %>' class="view-button" title='<%# Eval("ten_sp") %>'>
                        </a>
                    </div>
                    <div class="small-box-sale">
                        <p>
                            <%# Eval("gia_km") %><span> VNĐ</span></p>
                        <div class="small-box-save">
                            <span class="number">
                                <%# Eval("giam") +"%" %></span> <span>tiết kiệm</span>
                        </div>
                        <div class="small-box-price">
                            <span class="number" id="Time_CountDown_4037">
                                <%# Eval("con_lai") %>
                                ngày</span> <span>thời gian còn lại</span>
                        </div>
                    </div>
                    <div class="clear">
                    </div>
                </div>
            </td>
        </ItemTemplate>
        <LayoutTemplate>
            <table id="Table1" runat="server" class="product">
                <tr id="Tr1" runat="server">
                    <td id="Td2" runat="server">
                        <table id="groupPlaceholderContainer" runat="server" border="0" style="">
                            <tr id="groupPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr id="Tr2" runat="server">
                    <td id="Td3" runat="server" style="">
                        <asp:DataPager ID="DataPager1" runat="server" PageSize="9">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False"
                                    ShowPreviousPageButton="False" />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False"
                                    ShowPreviousPageButton="False" />
                            </Fields>
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
    </asp:ListView>
    <asp:SqlDataSource ID="SqlDataSourceDealMoi" runat="server" ConnectionString="<%$ ConnectionStrings:babydealConnectionString %>"
        
        SelectCommand="SELECT id, id_doanh_nghiep, id_the_loai, ten_sp, mo_ta_sp, gia_goc, gia_km, ngay_bat_dau, ngay_ket_thuc, so_luong_toi_da, so_luong_toi_thieu, noi_dung, dieu_kien_ap_dung, dac_trung, anh_1, anh_2, anh_3, anh_4, anh_5, da_duoc_duyet, (gia_goc - gia_km) * 100 / gia_goc AS giam, DATEDIFF(DD, ngay_bat_dau, ngay_ket_thuc) AS con_lai FROM khuyen_mai WHERE (da_duoc_duyet = @da_duoc_duyet AND id_the_loai = @the_loai) and GETDATE() BETWEEN ngay_bat_dau and ngay_ket_thuc ORDER BY id DESC">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="da_duoc_duyet" Type="Int32" />
            <asp:QueryStringParameter DefaultValue="" Name="the_loai" 
                QueryStringField="category" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>

